package com.allo2o.common.lepayEnum;

import org.apache.commons.lang.StringUtils;

/**
 * Created by Lu.Bing on 16-7-8.
 *
 * @author Lu.Bing
 */
public enum ProfitPayTypeEnum {

    ALIPAY_PROFIT("alipay_direct_share_profit", "支付宝"),
    ALIPAY_PROFIT_INDIRECT("alipay_indirect_share_profit", "支付宝"),
    WECHAT_PROFIT("wechat_direct_share_profit", "微信"),
    WECHAT_PROFIT_INDIRECT("wechat_indirect_share_profit", "微信");

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    ProfitPayTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ProfitPayTypeEnum getEnumByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        ProfitPayTypeEnum[] arr = ProfitPayTypeEnum.values();
        for (ProfitPayTypeEnum anArr : arr) {
            if (anArr.getCode().equalsIgnoreCase(code)) {
                return anArr;
            }
        }
        return null;
    }
}
